package com.brillilab.service.module.message.template.impl.experiment;

import com.alibaba.fastjson.JSONObject;
import com.brillilab.service.module.message.template.AbstractMessageTemplate;
import com.brillilab.service.module.message.template.enums.MessageTypeEnum;
import lombok.Data;

/**
 * @author zlb
 * @Title: ExperimentCountdownEndTemp
 * @ProjectName brill_lab
 * @Description: 实验倒计时结束-模板
 * @date 2019/5/28 9:51
 */
@Data
public class ExperimentCountdownEndTemp extends AbstractMessageTemplate {
    private String experimentName;
    private String stepNo;
    private Long experimentId;
    private Long phaseId;
    private Long stepId;

    /**
     * 实验倒计时结束
     *
     * @param labId       实验室ID
     * @param executorUid  接收人ID
     * @param executor 接收者实验室成员Id
     * @param experimentName  实验目标名称
     * @param stepNo      步骤序号
     */
    public ExperimentCountdownEndTemp(Long labId, Long executorUid,Long executor, String experimentName, String stepNo, Long experimentId,Long phaseId,Long stepId) {
        super(labId, executorUid);
        super.setType(MessageTypeEnum.ExperimentCountdownEnd.getValue());
        super.setTitle("实验倒计时已结束");
        String content = String.format("<span style='color:#F6AC2D'>%s</span><span>内</span>" +
                "<span style='color:#F6AC2D'>%s</span><span>的倒计时结束</span>", experimentName, stepNo);
        super.setContent(content);
        super.setAppContent(String.format("%s内%s的倒计时结束", experimentName, stepNo));
        this.labMemberId=executor;
        this.experimentName = experimentName;
        this.stepNo = stepNo;
        this.experimentId = experimentId;
        this.phaseId = phaseId;
        this.stepId = stepId;
    }

    @Override
    public String getJsonData() {
        JSONObject object = new JSONObject();
        object.put("experimentId",experimentId);
        object.put("phaseId",phaseId);
        object.put("stepId",stepId);
        object.put("content",appContent);
        return object.toJSONString();
    }

}
